package io;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * @version 1.8
 * @Author Djx_hmbb
 * @Date 2023/8/30 16:35
 * @注释:输入流的字符流Reader
 */
public class IODemo9 {
    public static void main(String[] args) throws IOException {
        try(Reader reader = new FileReader("./ddd.txt")){
           /* while (true){
                int len = reader.read();
                if(len == -1){
                    break;
                }
            }*/
            while(true){
                char[] tmp = new char[5];//用来缓存一次读取的字符个数
                int len = reader.read(tmp);//计算读取字符数的个数
                System.out.println("len: "+len);
                if(len == -1){
                    break;
                }
                for (int i = 0; i < len; i++) {
                    System.out.println(tmp[i]);
                }
            }
        }
    }
}
